<?php
include "conn.php";
if(isset($_POST['phone']) || isset($_POST['submit'])){//获取手机号
    $phone=@$_POST['phone'];
    $result=$conn->query("select * from userlib where phone='$phone'");
    if($result->fetch_assoc()){//如果$result->fetch_assoc()有值，返回true,否则就是false;
        echo true;
    }else{
        echo false;
    }
}
else{
    exit('非法操作');//输出非法操作，终止程序   
}

//将表单的值接收，放入数据库。
if(isset($_POST['submit'])){//点击了注册按钮
    $phone=$_POST['phone'];
    $pass=sha1($_POST['password']);
    $conn->query("insert userlib values(null,'$phone','$pass',null,NOW())");
    header('location:http://10.31.155.44/02/yiguo/src/login.html');
}